package classes.view.component
{
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	public class PopupPagingNum extends Sprite
	{
		private var _pagingNum:int;
		
		private var _pagingText_A:TextField;
		private var _pagingText_B:TextField;
		
		public function PopupPagingNum()
		{
			super();
			setLayOut();
		}
		private function setLayOut():void
		{
			this.mouseChildren = false;
			this._pagingText_A	=	this.getChildByName('off_txt')	as TextField;
			this._pagingText_B	=	this.getChildByName('on_txt')	as TextField;
			this._pagingText_B.visible = false;
			
			this.buttonMode = true;
			this.addEventListener(MouseEvent.ROLL_OVER, thisOver);
			this.addEventListener(MouseEvent.ROLL_OUT, thisOver);
		}
		
		private function thisOver(e:MouseEvent):void 
		{
			switch (e.type) 
			{
				case "rollOver":
					this._pagingText_A.visible = false;
					this._pagingText_B.visible = true;
					break;
				case "rollOut":
					this._pagingText_A.visible = true;
					this._pagingText_B.visible = false;
					break;
			}
		}
		
		public function set selectPage($select:Boolean):void
		{
			if($select){
				this.mouseChildren = false;
				this.mouseEnabled  = false;
				
				this._pagingText_A.visible = false;
				this._pagingText_B.visible = true;
				
				//init = false;
				//stopFrame();
				//gotoAndStop("over");
			}else{
				this.mouseChildren = true;
				this.mouseEnabled  = true;
				
				this._pagingText_A.visible = true;
				this._pagingText_B.visible = false;
				//playFrame("out");
				//init = true;
			}
		}
		
		public function set pagingNum($pageNum:int):void
		{
			this._pagingNum = $pageNum;
			this._pagingText_A.text = String($pageNum); //0부터 시작하므로, 1더함.
			this._pagingText_B.text = String($pageNum);
		}
		
		public function get pagingNum():int
		{
			return _pagingNum;
		}
		
	}
}